#!/usr/bin/perl -wait
use strict;

$#ARGV == 1 or die "$0 in.fa chr.\n";

open GEN, "$ARGV[0]";

my $if_print;

while (<GEN>) {
	if (/^>/) {
		if ($if_print) {
			last;
		}else {
			if (/^>([C|c]hr)?$ARGV[1]\b/) {
				$if_print=1;
				print;
			}
		}
		
	}else {
		if ($if_print) {
			print;
		}
	}
}

close GEN;